<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css">
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;margin-left: 40px">

    <form class="layui-form"> <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
        <div class="layui-form-item">
            <span style="display: inline-block;font-weight: 700;font-size: 30px;margin-top: 10px">应收记录管理</span>
            <div class="layui-input-block" style="width: 150px;display: inline-block;margin-left: 33px">
                <select name="interest" lay-filter="xiaoqu" >
                    <option value="0">请选择小区</option>
                    <option value="1">金华小区</option>
                </select>
            </div>
        </div>
    </form>
</fieldset>
<div class="layui-row layui-col-space10">

    <div class="layui-col-md2">
        <div class="grid-demo" style="border: 1px solid #e2e2e2;margin-left: 10px;margin-right: 10px">

            <form class="layui-form"> <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
                <div class="layui-form-item" style="text-align: center;margin-top: 10px">
                    <span style="display: inline-block;font-weight: 700;color:dimgray;font-size: 20px;margin-left: 20px;margin-top: 10px">房间列表</span>
                    <div class="layui-input-block" style="width: 100px;display: inline-block;margin-left: 33px">
                        <button type="button"	class="layui-btn layui-btn-primary layui-btn-sm" >条件查询</button>
                    </div>
                </div>
            </form>


<!--            房间列表-->
            <div id="houseList" style="text-align: center;background-color: transparent;margin-bottom: 10px " >
                <ul class="layui-nav layui-nav-tree layui-inline" lay-filter="demo" style="margin-right: 10px;">
                    <li class="layui-nav-item layui-nav-itemed">
                        <a href="javascript:;" style="text-align: left;margin-left: 10px">▌A栋</a>
                        <dl class="layui-nav-child">
                            <dd><a href="javascript:;">1A-1001</a></dd>
                            <dd><a href="javascript:;">1A-1002</a></dd>
                            <dd><a href="javascript:;">1A-1003</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item layui-nav-itemed">
                        <a href="javascript:;"  style="text-align: left;margin-left: 10px">▌B栋</a>
                        <dl class="layui-nav-child" style="background-color: transparent">
                            <dd><a href="javascript:;">1B-1001</a></dd>
                            <dd><a href="javascript:;">2B-2002</a></dd>
                            <dd><a href="javascript:;">3B-3003</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>
        </div>
    </div>


    <div class="layui-col-md10">
        <!-- 上面部分  -->
        <div class="grid-demo grid-demo-bg1" style="border: 1px solid #e2e2e2;margin-right: 20px ">
            <div class="layui-row"  style="margin-top: 10px">
                <div class="layui-col-md3">
                    <!--          应收列表select，费用查询        -->
                    <form class="layui-form"> <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
                        <div class="layui-form-item">
                            <span style="display: inline-block;font-weight: 700;color:dimgray;font-size: 17px;margin-top: 10px;margin-left: 20px">应收列表</span>
                            <div class="layui-input-block" style="width: 150px;display: inline-block;margin-left: 33px;">
                                <select name="interest" lay-filter="feiyong">
                                    <option value="0">全部</option>
                                    <option value="1">物业费</option>
                                    <option value="2">车位费</option>
                                </select>
                            </div>
                        </div>
                    </form>
                </div>

                <!--  功能按钮  -->
                <div class="layui-col-md7 layui-col-md-offset2">
                    <button type="button" class="layui-btn layui-btn-warm " style="width: 90px">反审核</button>
                    <button type="button" class="layui-btn" style="width: 90px">审核</button>
                    <button type="button" class="layui-btn layui-btn-warm " style="width: 90px">导入</button>
                    <button type="button" class="layui-btn layui-btn-danger" style="width: 90px">删除</button>
                    <button type="button" class="layui-btn layui-btn-warm " style="width: 90px">需改单项</button>
                    <button type="button" class="layui-btn layui-btn-normal" style="width: 90px">添加单项</button>
                </div>
            </div>
        </div>
        <!-- 下面数据表格部分  -->
        <div id="mytables" style="margin-right: 20px">
        <table class="layui-hide" id="test" lay-filter="test"></table>
        </div>
        <script type="text/html" id="toolbarDemo">
            <div class="layui-btn-container">
                <button class="layui-btn layui-btn-sm" lay-event="getCheckData">获取选中行数据</button>
                <button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button>
                <button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button>
            </div>
        </script>

        <script type="text/html" id="barDemo">
            <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
        </script>

    </div>

</div>


</body>
<script src="../../layuiadmin/layui/layui.js"></script>

<script>
    layui.use(['form','jquery'],function(){
        var form = layui.form;
        let $ = layui.jquery;
        //各种基于事件的操作，下面会有进一步介绍

        //小区改变监听
        form.on('select(xiaoqu)', function(data){
            console.log(data.value); //得到被选中的值
        });

        //收费名称改变监听
        form.on('select(feiyong)', function(data){
            console.log(data.value); //得到被选中的值
        });



    });

</script>

<!--  数据表格渲染   -->
<script>
    layui.use('table', function(){
        var table = layui.table;

        table.render({
            elem: '#test'
            ,url:'../../test/table/demo1.json.js'/*tpa=http://www.ilayuis.com/test/table/demo1.json*/
            ,toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
            ,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
                title: '提示'
                ,layEvent: 'LAYTABLE_TIPS'
                ,icon: 'layui-icon-tips'
            }]
            ,title: '用户数据表'
            ,cols: [[
                {type: 'checkbox', fixed: 'left'}
                ,{field:'id',  title:'序号',  fixed: 'left', unresize: true, sort: true,align: 'center'}
                ,{field:'roomId', title:'房间号', edit: 'text',align: 'center'}
                ,{field:'name', title:'业主姓名',  edit: 'text',align: 'center'}
                ,{field:'chargeName', title:'收费名称',  edit: 'text',align: 'center', templet: function(res){
                        return '<em>'+ res.payItems.chargeName +'</em>'
                    }}
                ,{field:'summation', title:'应收金额',  edit: 'text',align: 'center', sort: true}
                ,{field:'chargePrice', title:'单价',  edit: 'text',align: 'center', sort: true}
                ,{field:'pennaltyRate', title:'倍率',align: 'center' }
                ,{field:'chargeStartDate', title:'计费开始日期',align: 'center'}
                ,{field:'chargeEndDate', title:'计费结束日期',align: 'center', sort: true}
                ,{field:'bindingTime', title:'录入时间',align: 'center'}
                ,{field:'recordPerson', title:'录入人',align: 'center'}
                ,{field:'auditStatus', title:'审核状态',align: 'center', templet: function(res){
                        if(res.auditStatus==0){
                            return '<em>待审核</em>'
                        }else if (res.auditStatus==1){
                            return '<em>已审核</em>'
                        }

                    }}
                ,{fixed: 'auditPerson', title:'审核人',align: 'center', toolbar: '#barDemo'}
            ]]
            ,page: true
        });

        //头工具栏事件
        table.on('toolbar(test)', function(obj){
            var checkStatus = table.checkStatus(obj.config.id);
            switch(obj.event){
                case 'getCheckData':
                    var data = checkStatus.data;
                    layer.alert(JSON.stringify(data));
                    break;
                case 'getCheckLength':
                    var data = checkStatus.data;
                    layer.msg('选中了：'+ data.length + ' 个');
                    break;
                case 'isAll':
                    layer.msg(checkStatus.isAll ? '全选': '未全选');
                    break;

                //自定义头工具栏右侧图标 - 提示
                case 'LAYTABLE_TIPS':
                    layer.alert('这是工具栏右侧自定义的一个图标按钮');
                    break;
            };
        });

        //监听行工具事件
        table.on('tool(test)', function(obj){
            var data = obj.data;
            //console.log(obj)
            if(obj.event === 'del'){
                layer.confirm('真的删除行么', function(index){
                    obj.del();
                    layer.close(index);
                });
            } else if(obj.event === 'edit'){
                layer.prompt({
                    formType: 2
                    ,value: data.email
                }, function(value, index){
                    obj.update({
                        email: value
                    });
                    layer.close(index);
                });
            }
        });
    });
</script>

<!--房间列表事件-->
<script>
    layui.use('element', function(){
        var element = layui.element; //导航的hover效果、二级菜单等功能，需要依赖element模块

        //监听导航点击
        element.on('nav(demo)', function(elem){
            //console.log(elem)
            layer.msg(elem.text());
        });
    });
</script>
</html>